package com.wu.foodsafetyplayer.app.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.dueeeke.videoplayer.ijk.IjkPlayerFactory;
import com.dueeeke.videoplayer.player.VideoView;
import com.wu.foodsafetyplayer.R;

/**
 * GridView适配器
 *
 * @author zihao
 */
public class VideoNvaAdapter extends BaseAdapter {
    private static final String TAG = VideoNvaAdapter.class.getSimpleName();
    private LayoutInflater inflater;
    private String[] itemNames = new String[]{"共有设备", "我的设备", "其他"};
    private Context context;

    public VideoNvaAdapter(Context context) {
        inflater = LayoutInflater.from(context);
        this.context = context;
    }

    @Override
    public int getCount() {
        return itemNames.length;
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return itemNames[position];
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        ViewHolder holder;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.item_monitor_video_nva, null);
            holder = new ViewHolder();
            holder.itemName = convertView.findViewById(R.id.item_monotor_video_nva_name);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.itemName.setText(itemNames[position]);
        return convertView;
    }

    /**
     * 工具类
     */
    private class ViewHolder {
        TextView itemName;
    }

}
